package org.eclipse.rally.plugin.views;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.swing.JOptionPane;
import org.eclipse.rally.plugin.views.DefectDetailGUI;
import org.apache.log4j.Logger;
import org.eclipse.rally.plugin.Activator;
import org.eclipse.rally.plugin.utils.RallyConstants;
import org.eclipse.rally.plugin.utils.SWTResourceManager;
import org.eclipse.rally.plugin.webservice.RallyMain;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;

import com.rallydev.webservice.v1_12.domain.Defect;
import com.rallydev.webservice.v1_12.domain.HierarchicalRequirement;
import com.rallydev.webservice.v1_12.domain.Task;
import com.rallydev.webservice.v1_12.domain.TestCase;


public class DashboardGUI {
    public static Shell shell;
    public static ScrolledComposite scrolledComposite;
    public static Group group,grpTask,grpUserStory,group_1;
    private static Composite composite_1;
    public static TabItem tabItem;
    public static TabFolder tabFolder;
    private static CCombo stateCombo,prioritycombo,stateTaskCombo,us_owner,us_type;
    private static int minDefVal = 1;
    private static int maxDefVal = 5;
    private static int defPageNumber = 1;
    private static Text text_4,IdTasktext,us_text;
    public static int totalDefects;
    private static List lstTasks,lstTests,lstDefects,lstUser;
    private static int minTaskVal = 1;
    private static int maxTaskVal = 5;
    private static int taskPageNumber = 1;
    public static int totalTasks,totalTests;
    private static Text text_5,Idtext,IdTestText,text_6,us_counttext;
    private static CCombo typeTestCombo,priorityTestCombo;
    private static int minTestVal = 1;
    private static int maxTestVal = 5;
    private static Table testsTable,defectsTable,table_3,table_2,tasksTable;
    private static int testPageNumber = 1;
    public static  Label lblPageNumber,label_5,label_6,label_7,label_8,lblPageNumberus;
    static Map refMap,refTaskMap,refUserMap;
    
    final Display display = Display.getCurrent();
    final Cursor handCursor = new Cursor(display, SWT.CURSOR_HAND);
    final Cursor waitCursor = new Cursor(display, SWT.CURSOR_WAIT);
    private Logger logger = Activator.getLogManager().getLogger(DashboardGUI.class.getName());
    
    public void main(String[] args) {
        Display display = new Display();
        shell = new Shell(display);
        shell.setMinimumSize(new Point(800, 600));
        shell.setLayout(new FillLayout());

        String id = "DE5731";
        TabFolder tabFolder = new TabFolder(shell, SWT.NONE);

        dashBoard(tabFolder);
        shell.setSize(800, 600);
        shell.open();

        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }

        display.dispose();
    }


    public void defectGroup(Composite composite_1, final TabFolder tabFolder) {	
        group = new Group(composite_1, SWT.BORDER);
        group.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        group.setBounds(2, 25, 460, 250);
        group.setText("My Defects");

        {
            {
                Label label = new Label(group, SWT.CENTER);
                label.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label.setText("ID");
                label.setBounds(10, 60, 36, 13);
            }

            {
                Label label = new Label(group, SWT.NONE);
                label.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label.setText("Priority");

                label.setAlignment(SWT.CENTER);
                label.setBounds(144, 60, 49, 13);
            }

            {
                Label label = new Label(group, SWT.NONE);
                label.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label.setText("State");

                label.setBounds(278, 60, 65, 13);
            }

            Idtext = new Text(group, SWT.BORDER);
            Idtext.setBounds(20, 79, 76, 19);
            prioritycombo = new CCombo(group, SWT.BORDER);
            prioritycombo.setText("All");
            prioritycombo.setItems(new String[] {
                    "All", "Resolve Immediately", "High Attention", "Normal",
                    "Low"
                });
            prioritycombo.setEditable(false);
            prioritycombo.setBackground(SWTResourceManager
            		.getColor(SWT.COLOR_LIST_BACKGROUND));
            prioritycombo.setBounds(135, 79, 128, 21);
            stateCombo = new CCombo(group, SWT.BORDER);
            stateCombo.setText("Open");
            stateCombo.setItems(new String[] {
                    "All", "Submitted", "Open", "As Designed", "Fixed",
                    "Re-open", "Deferred", "Obsolete", "Cannot Reproduce",
                    "Verified", "Closed"
                });
            stateCombo.setEditable(false);
            stateCombo.setBackground(SWTResourceManager
            		.getColor(SWT.COLOR_LIST_BACKGROUND));
            stateCombo.setBounds(278, 79, 88, 21);

            {
                final Label clbl_Filter = new Label(group, SWT.NONE);
                clbl_Filter.setImage(SWTResourceManager.getImage(
                        DashboardGUI.class, "/icons/Search-enabled.gif"));
                clbl_Filter.setBounds(395, 79, 58, 23);
                clbl_Filter.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                clbl_Filter.setCursor(handCursor);
                clbl_Filter.addMouseListener(new MouseAdapter() {
                        @Override
                        public void mouseDown(MouseEvent e) {
                        	logger.info("***** Defect Search Initiated");
                        	setCurssor(clbl_Filter, true);
                            defPageNumber = 1;
                            minDefVal = 1;
                            text_4.setText(defPageNumber + "");
                            populateDefects();
                            setCurssor(clbl_Filter, false);
                            logger.info("***** Defect Search Finished");
                        }
                    });
            }

            {
                Label label = new Label(group, SWT.SEPARATOR | SWT.HORIZONTAL);

                label.setAlignment(SWT.CENTER);
                label.setBounds(10, 104, 446, 2);
            }

            defectsTable = new Table(group, SWT.BORDER | SWT.FULL_SELECTION);
            defectsTable.setLinesVisible(true);
            defectsTable.setHeaderVisible(true);
            defectsTable.setBounds(11, 104, 445, 103);
            defectsTable.addListener(SWT.MouseDoubleClick,
                new Listener() {
                    public void handleEvent(Event e) {
                    	logger.info("***** Defect Details Initiated");
                        // String string = "";
                        int id = 1;

                        //     TableItem[] selection = defectsTable.getSelection();
                        //if (table_3.getItems()==null)
                        TableItem[] items = defectsTable.getItems();

                        if (items.length == 0) {
                            JOptionPane.showMessageDialog(null,
                                "Nothing to Display", "", 0);
                        } else {
                            TableItem string = null;
                            TableItem[] selection = defectsTable.getSelection();
                            string = (TableItem) selection[selection.length -
                                1];

                            String strRefrence = (String) refMap.get(string.getText());
                            group.dispose();
                            grpTask.dispose();
                            grpUserStory.dispose();
                            group_1.dispose();

                            try {
                                new DefectDetailGUI().defectDetail(tabFolder,
                                    tabItem, strRefrence, RallyConstants.PAGE_DASHBOARD);
                            } catch (Exception e1) {
                                e1.printStackTrace();
                                logger.error(e1);
                            }
                        }
                        logger.info("***** Defect Details Finished");
                    }
                });

            {
                TableColumn tableColumn = new TableColumn(defectsTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("ID");
            }

            {
                TableColumn tableColumn = new TableColumn(defectsTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("Type");
            }

            {
                TableColumn tableColumn = new TableColumn(defectsTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("Priority");
            }

            {
                TableColumn tableColumn = new TableColumn(defectsTable, SWT.NONE);
                tableColumn.setWidth(137);
                tableColumn.setText("Status");
            }

            populateDefects();

            final Label label = new Label(group, SWT.NONE);
            label.setBounds(287, 213, 43, 21);
            label.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-MoveAll.gif"));
            label.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label.setCursor(handCursor);
            label.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Defects Last Page Initiated");
                    	setCurssor(label, true);
                        int x = totalDefects % maxDefVal;
                        int y = (totalDefects / maxDefVal);

                        if (x == 0) {
                            defPageNumber = y;
                        } else {
                            defPageNumber = y + 1;
                        }

                        minDefVal = (defPageNumber * maxDefVal) -
                            (maxDefVal - 1);
                        text_4.setText(defPageNumber + "");
                        populateDefects();
                        setCurssor(label, false);
                        logger.info("***** Defects Last Page Finished");
                    }
                });

            final Label label_3 = new Label(group, SWT.NONE);
            label_3.setBounds(235, 213, 36, 21);
            label_3.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/FF-enabled.gif"));
            label_3.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_3.setCursor(handCursor);
            label_3.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Defects Next Page Initiated");
                    	setCurssor(label_3, true);
                        if (lstDefects.size() == maxDefVal) {
                            minDefVal += maxDefVal;
                            defPageNumber++;
                            text_4.setText(defPageNumber + "");
                        }

                        populateDefects();
                        setCurssor(label_3, false);
                        logger.info("***** Defects Next Page Finished");
                    }
                });

            final Label label_4 = new Label(group, SWT.NONE);
            label_4.setBounds(182, 213, 36, 21);
            label_4.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-REW.gif"));
            label_4.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_4.setCursor(handCursor);
            label_4.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Defects Previous Page Initiated");
                    	setCurssor(label_4, true);
                        if (minDefVal > 1) {
                            minDefVal -= maxDefVal;
                            defPageNumber--;
                            text_4.setText(defPageNumber + "");
                        }

                        populateDefects();
                        setCurssor(label_4, false);
                        logger.info("***** Defects Previous Page Finished");
                    }
                });

            label_5 = new Label(group, SWT.NONE);
            label_5.setBounds(125, 213, 43, 21);
            label_5.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-RemoveAll.gif"));
            label_5.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_5.setCursor(handCursor);
            label_5.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Defects First Page Initiated");
                    	setCurssor(label_5, true);
                        minDefVal = 1;
                        defPageNumber = 1;
                        text_4.setText(defPageNumber + "");

                        populateDefects();
                        setCurssor(label_5, false);
                        logger.info("***** Defects First Page Finished");
                    }
                });

            text_4 = new Text(group, SWT.BORDER);
            text_4.setBounds(350, 213, 43, 21);
            text_4.setText(defPageNumber + "");

            lblPageNumber = new Label(group, SWT.NONE);
            lblPageNumber.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_WHITE));
            lblPageNumber.setBounds(395, 213, 43, 21);
            lblPageNumber.setText("P No :");
        }
    }

    public void taskGroup(Composite composite_1) {
        grpTask = new Group(composite_1, SWT.BORDER);
        grpTask.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        grpTask.setBounds(2, 285, 460, 250);
        grpTask.setText("My &Tasks");

        {
            {
                Label label = new Label(grpTask, SWT.CENTER);
                label.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label.setText("ID");

                label.setBounds(10, 60, 36, 13);
            }

            {
                Label lblPriority = new Label(grpTask, SWT.NONE);
                lblPriority.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                lblPriority.setText("Status");

                lblPriority.setAlignment(SWT.CENTER);
                lblPriority.setBounds(144, 60, 49, 13);
            }

            {
                Label label = new Label(grpTask, SWT.NONE);
                label.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label.setText("Last Verdict");

                label.setBounds(278, 60, 65, 13);
            }

            IdTasktext = new Text(grpTask, SWT.BORDER);
            IdTasktext.setBounds(20, 79, 76, 19);
            stateTaskCombo = new CCombo(grpTask, SWT.BORDER);
            stateTaskCombo.setText("All");
            stateTaskCombo.setItems(new String[] {
                    "All", "Defined", "In-Progress", "Completed"
                });
            stateTaskCombo.setEditable(false);
            stateTaskCombo.setBackground(SWTResourceManager
            		.getColor(SWT.COLOR_LIST_BACKGROUND));
            stateTaskCombo.setBounds(144, 79, 88, 21);

            {
                CCombo combo = new CCombo(grpTask, SWT.BORDER);
                combo.setText("All");
                combo.setItems(new String[] {
                        "Bocked", "Error", "Fail", "Inconclusive", "Pass"
                    });
                combo.setEditable(false);
                combo.setBackground(SWTResourceManager
                		.getColor(SWT.COLOR_LIST_BACKGROUND));
                combo.setBounds(278, 79, 88, 21);
            }

            {
                final Label clbl_Filter = new Label(grpTask, SWT.NONE);
                clbl_Filter.setImage(SWTResourceManager.getImage(
                        DashboardGUI.class, "/icons/Search-enabled.gif"));
                clbl_Filter.setBounds(395, 79, 58, 23);
                clbl_Filter.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                clbl_Filter.setCursor(handCursor);
                clbl_Filter.addMouseListener(new MouseAdapter() {
                        @Override
                        public void mouseDown(MouseEvent e) {
                        	logger.info("***** Tasks Search Initiated");
                            setCurssor(clbl_Filter, true);
                            taskPageNumber = 1;
                            minTaskVal = 1;
                            text_5.setText(taskPageNumber + "");
                            populateTasks();
                            setCurssor(clbl_Filter, false);
                            logger.info("***** Tasks Search Finished");
                        }
                    });
            }

            {
                Label label = new Label(grpTask, SWT.SEPARATOR |
                        SWT.HORIZONTAL);
                label.setAlignment(SWT.CENTER);
                label.setBounds(10, 104, 446, 2);
            }

            tasksTable = new Table(grpTask, SWT.BORDER | SWT.FULL_SELECTION);
            tasksTable.setLinesVisible(true);
            tasksTable.setHeaderVisible(true);
            tasksTable.setBounds(11, 104, 445, 103);
            
            tasksTable.addListener(SWT.MouseDoubleClick,
                    new Listener() {
                        public void handleEvent(Event e) {
                        	logger.info("***** Task Details Initiated");
                            // String string = "";
                            int id = 1;

                            //     TableItem[] selection = defectsTable.getSelection();
                            //if (table_3.getItems()==null)
                            TableItem[] items = tasksTable.getItems();

                            if (items.length == 0) {
                                JOptionPane.showMessageDialog(null,
                                    "Nothing to Display", "", 0);
                            } else {
                                TableItem string = null;
                                TableItem[] selection = tasksTable.getSelection();
                                string = (TableItem) selection[selection.length -
                                    1];

                                String strTaskRefrence = (String) refTaskMap.get(string.getText());
                                group.dispose();
                                grpTask.dispose();
                                grpUserStory.dispose();
                                group_1.dispose();

                                try {
                                    new TaskDetailGUI().taskDetail(tabFolder,
                                            tabItem, strTaskRefrence, RallyConstants.PAGE_DASHBOARD);
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                    logger.error(e1);
                                }
                            }
                            logger.info("***** Task Details Finished");
                        }
                    });
            

            {
                TableColumn tableColumn = new TableColumn(tasksTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("ID");
            }

            {
                TableColumn tableColumn = new TableColumn(tasksTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("Name");
            }

            {
                TableColumn tableColumn = new TableColumn(tasksTable, SWT.NONE);
                tableColumn.setWidth(100);
                tableColumn.setText("Status");
            }

            {
                TableColumn tableColumn = new TableColumn(tasksTable, SWT.NONE);
                tableColumn.setWidth(126);
                tableColumn.setText("Owner");
            }

            populateTasks();

            final Label label = new Label(grpTask, SWT.NONE);
            label.setBounds(264, 213, 43, 21);
            label.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-MoveAll.gif"));
            label.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label.setCursor(handCursor);
            label.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Tasks Last Page Initiated");
                    	setCurssor(label, true);
                        int x = totalTasks % maxTaskVal;
                        int y = (totalTasks / maxTaskVal);

                        if (x == 0) {
                            taskPageNumber = y;
                        } else {
                            taskPageNumber = y + 1;
                        }

                        minTaskVal = (taskPageNumber * maxTaskVal) -
                            (maxTaskVal - 1);
                        text_5.setText(taskPageNumber + "");
                        populateTasks();
                        setCurssor(label,false);
                        logger.info("***** Tasks Last Page Finished");
                    }
                });

            final Label label_3 = new Label(grpTask, SWT.NONE);
            label_3.setBounds(212, 213, 36, 21);
            label_3.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/FF-enabled.gif"));
            label_3.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_3.setCursor(handCursor);
            label_3.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Tasks Next Page Initiated");
                    	setCurssor(label_3, true);
                        if (lstTasks.size() == maxTaskVal) {
                            minTaskVal += maxTaskVal;
                            taskPageNumber++;
                            text_5.setText(taskPageNumber + "");
                        }

                        populateTasks();
                        setCurssor(label_3, false);
                        logger.info("***** Tasks Next Page Finished");
                    }
                });

            final Label label_4 = new Label(grpTask, SWT.NONE);
            label_4.setBounds(159, 213, 36, 21);
            label_4.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-REW.gif"));
            label_4.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_4.setCursor(handCursor);
            label_4.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Tasks Previous Page Initiated");
                    	setCurssor(label_4, true);
                        if (minTaskVal > 1) {
                            minTaskVal -= maxTaskVal;
                            taskPageNumber--;
                            text_5.setText(taskPageNumber + "");
                        }

                        populateTasks();
                        setCurssor(label_4, false);
                        logger.info("***** Tasks Previous Page Finished");
                    }
                });

            final Label label_5 = new Label(grpTask, SWT.NONE);
            label_5.setBounds(102, 213, 43, 21);
            label_5.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-RemoveAll.gif"));
            label_5.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_5.setCursor(handCursor);
            label_5.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	logger.info("***** Tasks First Page Initiated");
                    	setCurssor(label_5, true);
                        minTaskVal = 1;
                        taskPageNumber = 1;
                        text_5.setText(taskPageNumber + "");

                        populateTasks();
                        setCurssor(label_5, false);
                        logger.info("***** Tasks First Page Finished");
                    }
                });

           

            Label lblPageNumber = new Label(grpTask, SWT.NONE);
            lblPageNumber.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_WHITE));
            lblPageNumber.setBounds(350, 213, 43, 21);
            lblPageNumber.setText("P No :");
            
            text_5 = new Text(grpTask, SWT.BORDER);
            text_5.setBounds(395, 213, 43, 21);
            text_5.setText(taskPageNumber + "");
        }
    }

    public void userStoryGroup(Composite composite) {
        grpUserStory = new Group(composite, SWT.BORDER);
        grpUserStory.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));
        grpUserStory.setBounds(467, 25, 460, 250);
        grpUserStory.setText("My User Stories");

        {
            {
                Label label22 = new Label(grpUserStory, SWT.CENTER);
                label22.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label22.setText("ID");
                label22.setBounds(10, 60, 36, 13);
            }

            {
                Label label33 = new Label(grpUserStory, SWT.NONE);
                label33.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label33.setText("Type");

                label33.setAlignment(SWT.CENTER);
                label33.setBounds(144, 60, 49, 13);
            }

            {
                Label label_1 = new Label(grpUserStory, SWT.NONE);
                label_1.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                label_1.setText("Priority");

                label_1.setBounds(278, 60, 65, 13);
            }

            {
                us_text = new Text(grpUserStory, SWT.BORDER);
                us_text.setBounds(20, 79, 76, 19);
            }

            {
                us_type = new CCombo(grpUserStory, SWT.BORDER);
                us_type.setText("All");
                us_type.setItems(new String[] {
                        "Acceptence", "Functional", "Performance", "Regression",
                        "Usability", "User Interface"
                    });
                us_type.setEditable(false);
                us_type.setBackground(SWTResourceManager
                		.getColor(SWT.COLOR_LIST_BACKGROUND));
                us_type.setBounds(157, 79, 88, 21);
            }

            {
                us_owner = new CCombo(grpUserStory, SWT.BORDER);
                us_owner.setText("All");
                us_owner.setItems(new String[] {
                        "Bocked", "Error", "Fail", "Inconclusive", "Pass"
                    });
                us_owner.setEditable(false);
                us_owner.setBackground(SWTResourceManager
                		.getColor(SWT.COLOR_LIST_BACKGROUND));
                us_owner.setBounds(278, 79, 88, 21);
            }

            {
                final Label clbl_Filter = new Label(grpUserStory, SWT.NONE);
                clbl_Filter.setImage(SWTResourceManager.getImage(
                        DashboardGUI.class, "/icons/Search-enabled.gif"));
                clbl_Filter.setBounds(395, 79, 58, 23);
                clbl_Filter.setBackground(SWTResourceManager.getColor(
                        SWT.COLOR_LIST_BACKGROUND));
                clbl_Filter.setCursor(handCursor);
            }

            {
                Label label_2 = new Label(grpUserStory,
                        SWT.SEPARATOR | SWT.HORIZONTAL);

                label_2.setAlignment(SWT.CENTER);
                label_2.setBounds(10, 104, 446, 2);
            }

            {
                table_2 = new Table(grpUserStory,
                        SWT.BORDER | SWT.FULL_SELECTION);
                table_2.setLinesVisible(true);
                table_2.setHeaderVisible(true);
                table_2.setBounds(11, 104, 445, 103);

                {
                    TableColumn tableColumn = new TableColumn(table_2, SWT.NONE);
                    tableColumn.setWidth(100);
                    tableColumn.setText("ID");
                }

                {
                    TableColumn tableColumn = new TableColumn(table_2, SWT.NONE);
                    tableColumn.setWidth(100);
                    tableColumn.setText("Type");
                }

                {
                    TableColumn tableColumn = new TableColumn(table_2, SWT.NONE);
                    tableColumn.setWidth(100);
                    tableColumn.setText("Last Verdict");
                }

                {
                    TableColumn tableColumn = new TableColumn(table_2, SWT.NONE);
                    tableColumn.setWidth(126);
                    tableColumn.setText("Status");
                }
                populateUserStory();
            }
            ////////***********\
            table_2.addListener(SWT.MouseDoubleClick,
                    new Listener() {
                        public void handleEvent(Event e) {
                        	logger.info("***** User Story Details Initiated");
                            // String string = "";
                            int id = 1;

                            //     TableItem[] selection = defectsTable.getSelection();
                            //if (table_3.getItems()==null)
                            TableItem[] items = table_2.getItems();

                            if (items.length == 0) {
                                JOptionPane.showMessageDialog(null,
                                    "Nothing to Display", "", 0);
                            } else {
                                TableItem string = null;
                                TableItem[] selection = table_2.getSelection();
                                string = (TableItem) selection[selection.length -
                                    1];

                                String strRefrence = (String) refUserMap.get(string.getText());
                                group.dispose();
                                grpTask.dispose();
                                grpUserStory.dispose();
                                group_1.dispose();

                                try {
                                    //new DefectDetailGUI().defectDetail(tabFolder,tabItem, strRefrence, id);
                                    new UserStoryDetailGUI().userStoryDetail(tabFolder, tabItem, strRefrence, RallyConstants.PAGE_DASHBOARD);      
                                } catch (Exception e1) {
                                    e1.printStackTrace();
                                    logger.error(e1);
                                }
                            }
                            logger.info("***** User Story Details Finished");
                        }
                    });
            /////--------
           
            Label label11 = new Label(grpUserStory, SWT.NONE);
            label11.setBounds(286, 213, 43, 21);
            label11.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-MoveAll.gif"));
            label11.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label11.setCursor(handCursor);
            label11.setVisible(true);
            final Label label_3 = new Label(grpUserStory, SWT.NONE);
            label_3.setBounds(234, 213, 36, 21);
            label_3.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/FF-enabled.gif"));
            label_3.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_3.setCursor(handCursor);
            label_3.setVisible(true);
            label_3.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_3, true);
                        if (lstTests.size() == maxTestVal) {
                            minTestVal += maxTestVal;
                            testPageNumber++;
                            text_6.setText(testPageNumber + "");
                        }

                        populateUserStory();
                        setCurssor(label_3, false);
                    }
                });

            final Label label_4 = new Label(grpUserStory, SWT.NONE);
            label_4.setBounds(181, 213, 36, 21);
            label_4.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-REW.gif"));
            label_4.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_4.setCursor(handCursor);
            label_4.setVisible(true);
            label_4.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_4, true);
                        if (minTestVal > 1) {
                            minTestVal -= maxTestVal;
                            testPageNumber--;
                            text_6.setText(testPageNumber + "");
                        }

                        populateUserStory();
                        setCurssor(label_4, false);
                    }
                });

            final Label label_5 = new Label(grpUserStory, SWT.NONE);
            label_5.setBounds(124, 213, 43, 21);
            label_5.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-RemoveAll.gif"));
            label_5.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_5.setCursor(handCursor);
            label_5.setVisible(true);
            label_5.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_5, true);
                        minTestVal = 1;
                        testPageNumber = 1;
                        text_6.setText(testPageNumber + "");

                        populateUserStory();
                        setCurssor(label_5, false);
                    }
                });

          
            lblPageNumberus = new Label(grpUserStory, SWT.NONE);
            lblPageNumberus.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_WHITE));
            lblPageNumberus.setBounds(350, 213, 42, 21);
            lblPageNumberus.setText("P No :");
            us_counttext = new Text(grpUserStory, SWT.BORDER);
            us_counttext.setBounds(395, 213, 43, 21);
            us_counttext.setText(testPageNumber + "");
        }
    }

    public void testCasesGroup(Composite composite) {
        group_1 = new Group(composite, SWT.BORDER);
        group_1.setBounds(467, 285, 460, 250);
        group_1.setText("My Test Cases");
        group_1.setBackground(SWTResourceManager.getColor(
                SWT.COLOR_LIST_BACKGROUND));

        {
            Label label_1 = new Label(group_1, SWT.CENTER);
            label_1.setText("ID");
            label_1.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_1.setBounds(10, 60, 36, 13);

            Label label_2 = new Label(group_1, SWT.NONE);
            label_2.setText("Type");
            label_2.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_2.setAlignment(SWT.CENTER);
            label_2.setBounds(144, 60, 49, 13);

            Label label_3 = new Label(group_1, SWT.NONE);
            label_3.setText("Priority");
            label_3.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_3.setBounds(278, 60, 65, 13);

            IdTestText = new Text(group_1, SWT.BORDER);
            IdTestText.setBounds(20, 79, 76, 19);

            typeTestCombo = new CCombo(group_1, SWT.BORDER);
            typeTestCombo.setText("All");
            typeTestCombo.setItems(new String[] {
                    "All", "Acceptance", "Functional", "Performance",
                    "Regression", "Usability", "User Interface"
                });
            typeTestCombo.setEditable(false);
            typeTestCombo.setBackground(SWTResourceManager
            		.getColor(SWT.COLOR_LIST_BACKGROUND));
            typeTestCombo.setBounds(157, 79, 88, 21);

            priorityTestCombo = new CCombo(group_1, SWT.BORDER);
            priorityTestCombo.setText("All");
            priorityTestCombo.setItems(new String[] {
                    "All", "Useful", "Important", "Cretical"
                });
            priorityTestCombo.setEditable(false);
            priorityTestCombo.setBackground(SWTResourceManager
            		.getColor(SWT.COLOR_LIST_BACKGROUND));
            priorityTestCombo.setBounds(278, 79, 88, 21);

            final Label clbl_Filter = new Label(group_1, SWT.NONE);
            clbl_Filter.setImage(SWTResourceManager.getImage(
                    DashboardGUI.class, "/icons/Search-enabled.gif"));
            clbl_Filter.setBounds(395, 79, 58, 23);
            clbl_Filter.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            clbl_Filter.setCursor(handCursor);
            clbl_Filter.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(clbl_Filter, true);
                        testPageNumber = 1;
                        minTestVal = 1;
                        text_4.setText(testPageNumber + "");
                        populateTestCase();
                        setCurssor(clbl_Filter, false);
                    }
                });

            Label label_4 = new Label(group_1, SWT.SEPARATOR | SWT.HORIZONTAL);
            label_4.setAlignment(SWT.CENTER);
            label_4.setBounds(10, 104, 446, 2);

            testsTable = new Table(group_1, SWT.BORDER | SWT.FULL_SELECTION);
            testsTable.setSortDirection(SWT.UP);
            testsTable.setLinesVisible(true);
            testsTable.setHeaderVisible(true);
            testsTable.setBounds(11, 104, 445, 103);

            TableColumn tableColumn = new TableColumn(testsTable, SWT.NONE);
            tableColumn.setWidth(100);
            tableColumn.setText("ID");

            TableColumn tableColumn_1 = new TableColumn(testsTable, SWT.NONE);
            tableColumn_1.setWidth(100);
            tableColumn_1.setText("Type");

            TableColumn tableColumn_2 = new TableColumn(testsTable, SWT.NONE);
            tableColumn_2.setWidth(100);
            tableColumn_2.setText("Priority");

            TableColumn tableColumn_3 = new TableColumn(testsTable, SWT.NONE);
            tableColumn_3.setWidth(126);
            tableColumn_3.setText("Owner");

            populateTestCase();

            label_5 = new Label(group_1, SWT.NONE);
            label_5.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-RemoveAll.gif"));
            label_5.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_5.setBounds(100, 217, 43, 21);
            label_5.setCursor(handCursor);
            label_5.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_5, true);
                        minTestVal = 1;
                        testPageNumber = 1;
                        text_6.setText(testPageNumber + "");

                        populateTestCase();
                        setCurssor(label_5, false);
                    }
                });

            label_6 = new Label(group_1, SWT.NONE);
            label_6.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-REW.gif"));
            label_6.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_6.setBounds(157, 217, 36, 21);
            label_6.setCursor(handCursor);
            label_6.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_6, true);
                        if (minTestVal > 1) {
                            minTestVal -= maxTestVal;
                            testPageNumber--;
                            text_6.setText(testPageNumber + "");
                        }

                        populateTestCase();
                        setCurssor(label_6, false);
                    }
                });

            label_7 = new Label(group_1, SWT.NONE);
            label_7.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/FF-enabled.gif"));
            label_7.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_7.setBounds(210, 217, 36, 21);
            label_7.setCursor(handCursor);
            label_7.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_7, true);
                        if (lstTests.size() == maxTestVal) {
                            minTestVal += maxTestVal;
                            testPageNumber++;
                            text_6.setText(testPageNumber + "");
                        }

                        populateTestCase();
                        setCurssor(label_7, false);
                    }
                });

            label_8 = new Label(group_1, SWT.NONE);
            label_8.setImage(SWTResourceManager.getImage(DashboardGUI.class,
                    "/icons/Button-MoveAll.gif"));
            label_8.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_LIST_BACKGROUND));
            label_8.setBounds(262, 217, 43, 21);
            label_8.setCursor(handCursor);
            label_8.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent e) {
                    	setCurssor(label_8, true);
                        int x = totalTests % maxTestVal;
                        int y = (totalTests / maxTestVal);

                        if (x == 0) {
                            testPageNumber = y;
                        } else {
                            testPageNumber = y + 1;
                        }

                        minTestVal = (testPageNumber * maxTestVal) -
                            (maxTestVal - 1);
                        text_6.setText(testPageNumber + "");
                        populateTestCase();
                        setCurssor(label_8, false);
                    }
                });

            text_6 = new Text(group_1, SWT.BORDER);
            text_6.setBounds(312, 217, 43, 21);
            text_6.setText(testPageNumber + "");

            lblPageNumber = new Label(group_1, SWT.NONE);
            lblPageNumber.setBackground(SWTResourceManager.getColor(
                    SWT.COLOR_WHITE));
            lblPageNumber.setBounds(362, 217, 43, 21);
            lblPageNumber.setText("P No :");
        }
    }

    public void dashBoard(TabFolder tabFolder_1 ) {
        tabFolder = tabFolder_1;       
        tabItem = new TabItem(tabFolder, SWT.NONE);
        tabItem.setText("&Home");  

        composite_1 = new Composite(tabFolder, SWT.BORDER);
        tabItem.setControl(composite_1);

        defectGroup(composite_1, tabFolder);
        userStoryGroup(composite_1);
        taskGroup(composite_1);
        testCasesGroup(composite_1);
    }

    public void populateDefects() {
        try {
            composite_1.setCursor(waitCursor);

            Defect defect = new Defect();

            if (Idtext.getText().trim().length() > 0) {
                defect.setFormattedID(Idtext.getText());
            } else {
                defect.setFormattedID(null);
            }

            if (!stateCombo.getText().equalsIgnoreCase("All")) {
                defect.setState(stateCombo.getText());
            } else {
                defect.setState(null);
            }

            if (!prioritycombo.getText().equalsIgnoreCase("All")) {
                defect.setPriority(prioritycombo.getText());
            } else {
                defect.setPriority(null);
            }

            if ((HeaderPage.userEmailFromRally != null) &&
                    !HeaderPage.userEmailFromRally.trim().equals("")) {
                defect.setOwner(HeaderPage.userEmailFromRally);
            }

            RallyMain rallyMain = new RallyMain();

            if (lstDefects != null) {
                lstDefects.clear();
            }

            lstDefects = rallyMain.searchObject(defect, "Defect", minDefVal,
                    maxDefVal);
            defectsTable.removeAll();
            refMap = new HashMap();

            if ((lstDefects != null) && (lstDefects.size() > 0)) {
                for (int i = 0; i < lstDefects.size(); i++) {
                    TableItem tableItem = new TableItem(defectsTable, SWT.NONE);
                    Defect defect1 = (Defect) lstDefects.get(i);
                    refMap.put(defect1.getFormattedID(), defect1.getRef());

                    String[] strValue = {
                            defect1.getFormattedID(), defect1.getType(),
                            defect1.getPriority(), defect1.getState(),
                        };
                    tableItem.setText(strValue);
                }
            }
            else
            {
            	defectsTable.setVisible(false);
            	Label mess = new Label(group, SWT.LEFT);
            	mess.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess.setBounds(11, 103, 444, 35);
            	Label mess2 = new Label(group, SWT.CENTER);
            	mess2.setText("There are no items to display.");
            	mess2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess2.setBounds(11, 138, 444, 100);
            	
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e);
        }

        composite_1.setCursor(null);
    }

    private void populateTasks() {
        try {
            composite_1.setCursor(waitCursor);

            Task task = new Task();

            if (IdTasktext.getText().trim().length() > 0) {
                task.setFormattedID(IdTasktext.getText());
            } else {
                task.setFormattedID(null);
            }

            task.setRelease(null);

            if (!stateTaskCombo.getText().equalsIgnoreCase("All")) {
                task.setState(stateTaskCombo.getText());
            } else {
                task.setState(null);
            }

            if ((HeaderPage.userEmailFromRally != null) &&
                    !HeaderPage.userEmailFromRally.trim().equals("")) {
                task.setOwner(HeaderPage.userEmailFromRally);
            }

            RallyMain rallyMain = new RallyMain();

            if (lstTasks != null) {
                lstTasks.clear();
            }

            lstTasks = rallyMain.searchObject(task, "Task", minTaskVal,
                    maxTaskVal);
            tasksTable.removeAll();
            refTaskMap =  new HashMap();
            if ((lstTasks != null) && (lstTasks.size() > 0)) {
                for (int i = 0; i < lstTasks.size(); i++) {
                    TableItem tableItem = new TableItem(tasksTable, SWT.NONE);

                    Task task1 = (Task) lstTasks.get(i);
                    
                    refTaskMap.put(task1.getFormattedID(), task1.getRef());
                    
                    String[] strValue = {
                            task1.getFormattedID(), task1.getName(),
                            task1.getState(),
                            (String) DefectsTabGUI.userMap.get(task1.getOwner())
                        };
                    tableItem.setText(strValue);
                }
            }
            else
            {
            	
            	tasksTable.setVisible(false);
            	System.out.println("I am Here");
            	Label mess = new Label(grpTask, SWT.LEFT);
            	mess.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess.setBounds(11, 103, 444, 35);
            	Label mess2 = new Label(grpTask, SWT.CENTER);
            	mess2.setText("There are no items to display.");
            	mess2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess2.setBounds(11, 138, 444, 100);
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e);
        }

        composite_1.setCursor(null);
    }

    private void populateTestCase() {
        try {
            composite_1.setCursor(waitCursor);

            TestCase testCase = new TestCase();

            if (IdTestText.getText().trim().length() > 0) {
                testCase.setFormattedID(IdTestText.getText());
            } else {
                testCase.setFormattedID(null);
            }

            if (!typeTestCombo.getText().equalsIgnoreCase("All")) {
                testCase.setType(typeTestCombo.getText());
            } else {
                testCase.setType(null);
            }

            if (!priorityTestCombo.getText().equalsIgnoreCase("All")) {
                testCase.setPriority(priorityTestCombo.getText());
            } else {
                testCase.setPriority(null);
            }

            if ((HeaderPage.userEmailFromRally != null) &&
                    !HeaderPage.userEmailFromRally.trim().equals("")) {
                testCase.setOwner(HeaderPage.userEmailFromRally);
            }

            RallyMain rallyMain = new RallyMain();

            if (lstTests != null) {
                lstTests.clear();
            }

            lstTests = rallyMain.searchObject(testCase, "TestCase", minTestVal,
                    maxTestVal);
            testsTable.removeAll();

            if ((lstTests != null) && (lstTests.size() > 0)) {
                for (int i = 0; i < lstTests.size(); i++) {
                    TableItem tableItem = new TableItem(testsTable, SWT.NONE);

                    TestCase task1 = (TestCase) lstTests.get(i);
                    String[] strValue = {
                            task1.getFormattedID(), task1.getType(),
                            task1.getPriority(),
                            (String) DefectsTabGUI.userMap.get(task1.getOwner())
                        };
                    tableItem.setText(strValue);
                }
            }
            else
            {   
            	//table_2.setVisible(false);
            	testsTable.setVisible(false);
            	lblPageNumber.setVisible(false);
            	text_4.setVisible(false);
            	Label mess = new Label(group_1, SWT.LEFT);
            	mess.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess.setBounds(11, 103, 444, 35);
            	Label mess2 = new Label(group_1, SWT.CENTER);
            	mess2.setText("There are no items to display.");
            	mess2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	mess2.setBounds(11, 138, 444, 100);

            	
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e);
        }

        composite_1.setCursor(null);
    }
    private void populateUserStory() {
        try {
        	HierarchicalRequirement userstory = new HierarchicalRequirement();

            	/*RallyMain rallyMain = new RallyMain();

            	List list = rallyMain.searchObject(hierarchicalRequirement, "HierarchicalRequirement", 1, 10);

            	for (Iterator iterator = list.iterator(); iterator.hasNext();) {

            	HierarchicalRequirement userstory = (HierarchicalRequirement) iterator.next();*/

            if (us_text.getText().trim().length() > 0) {
            	userstory.setFormattedID(us_text.getText());
            } else {
            	userstory.setFormattedID(null);
            }

            if (!us_type.getText().equalsIgnoreCase("All")) {
            	userstory.setType(us_type.getText());
            } else {
            	userstory.setType(null);
            }

            if (!us_owner.getText().equalsIgnoreCase("All")) {
            	userstory.setOwner(us_owner.getText());
            } else {
            	userstory.setOwner(null);
            }

            if ((HeaderPage.userEmailFromRally != null) &&
                    !HeaderPage.userEmailFromRally.trim().equals("")) {
            	userstory.setOwner(HeaderPage.userEmailFromRally);
            }

            RallyMain rallyMain = new RallyMain();

            if (lstUser != null) {
            	lstUser.clear();
            }

            lstUser = rallyMain.searchObject(userstory, "HierarchicalRequirement", minTestVal,
                    maxTestVal);
            table_2.removeAll();
            refUserMap = new HashMap();
            if ((lstUser != null) && (lstUser.size() > 0)) {
                for (int i = 0; i < lstUser.size(); i++) {
                    TableItem tableItem = new TableItem(table_2, SWT.NONE);

                    HierarchicalRequirement user_story = (HierarchicalRequirement) lstUser.get(i);
                    refUserMap.put(user_story.getFormattedID(), user_story.getRef());
                    String[] strValue = {
                    		user_story.getFormattedID(), user_story.getType(),
                    		user_story.getType(),
                            (String) DefectsTabGUI.userMap.get(user_story.getOwner())
                        };
                    tableItem.setText(strValue);
                    System.out.println("strValue + + + "+strValue.toString());
               }
           }
            else
            {   
            	table_2.setVisible(false);
            	Label umess = new Label(grpUserStory, SWT.LEFT);
            	umess.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	umess.setBounds(11, 103, 444, 35);
            	Label umess2 = new Label(grpUserStory, SWT.CENTER);
            	umess2.setText("There are no items to display.");
            	umess2.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_BACKGROUND));
            	umess2.setBounds(11, 138, 444,100);
            	
            }
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e);
        }

        composite_1.setCursor(null);
    }
    
    
    public void  backToDashboardPage(TabItem tabitem_1, TabFolder tabFolder_1) {
        composite_1.setCursor(waitCursor);
        tabFolder = tabFolder_1;
        tabItem = tabitem_1;

        Composite composite = new Composite(tabFolder, SWT.BORDER);
        tabItem.setControl(composite);
        defectGroup(composite, tabFolder);
        userStoryGroup(composite);
        taskGroup(composite);
        testCasesGroup(composite);
        composite_1.setCursor(null);
    }

    public void setCurssor(Label label, boolean b) {
        if (b) {
            label.setCursor(waitCursor);
        } else {
            label.setCursor(handCursor);
        }
    }
}
